import React from 'react'
import style from './basic.scss'
import { LogStatus } from '../../common/enums'

export const ProgressMark = ({ status, valid }) => {
    const imgMap = {
        [LogStatus.start]: { name: 'wait.png', remark: '执行中，请等待' },
        [LogStatus.pending]: { name: 'wait.png', remark: '执行中，请等待' },
        [LogStatus.pass]: valid ? { name: 'pass.png', remark: '执行完毕' } : { name: 'failure.png', remark: '执行失败' },
        [LogStatus.failure]: { name: 'failure.png', remark: '执行失败' },
        wait: { name: 'wait.png', remark: '等待执行' }
    },
        imgEntry = status ? imgMap[status] : imgMap.wait

    return (
        <span className={style.progress_mark}>
            <img title={imgEntry.remark} src={`../../../public/images/${imgEntry.name}`} />
        </span>)
}